-- Decompiled with the Synapse X Luau decompiler.

local l__CommonOHOH__1 = _G.CommonOHOH;
local u1 = l__CommonOHOH__1.class.new(script, l__CommonOHOH__1.files.BaseComponent());
function u1.dtor(p1)
	for v2, v3 in pairs(p1.animation_list) do
		v3:Destroy();
	end;
	p1.animation_list = {};
	for v4, v5 in pairs(p1.track_list) do
		v5:Destroy();
	end;
	p1.track_list = {};
	if p1.main_inst then
		p1.main_inst:Destroy();
	end;
	u1.super.dtor(p1);
end;
function u1.new(p2)
	return u1(p2);
end;
function u1.ctor(p3, p4)
	u1.super.ctor(p3, p4);
	p3:InitAnimationFolder();
	p3:InitController();
	p3:InitList();
	p4:AddHandleOnInWorkspace(function()
		p3:InWorkspace();
	end);
end;
local l__Instance__2 = Instance;
function u1.InitController(p5)
	local l__parent__6 = p5.parent;
	p5.controller = l__parent__6:GetHumanoid() or l__Instance__2.new("AnimationController", l__parent__6.main_inst);
end;
function u1.InitAnimationFolder(p6)
	local v7 = l__Instance__2.new("Folder", p6.parent.main_inst);
	v7.Name = "AniamtionComponent";
	p6:SetMainInst(v7);
end;
function u1.CreateAnimation(p7, p8, p9)
	local v8 = nil;
	local v9 = nil;
	v9, v8 = xpcall(function()
		local v10 = l__Instance__2.new("Animation", p7.main_inst);
		v10.Name = p8;
		v10.AnimationId = "http://www.roblox.com/asset/?id=" .. tostring(p9);
		return v10;
	end, debug.traceback);
	if v9 then
		return v8;
	end;
	warn(v8);
end;
function u1.LoadAnimation(p10, p11)
	local v11 = p10.controller:LoadAnimation(p11);
	v11.Name = p11.Name;
	return v11;
end;
local l__workspace__3 = workspace;
function u1.InitList(p12)
	local v12 = {};
	local v13 = {};
	local v14 = {};
	p12.animation_list = v12;
	p12.track_list = v13;
	function v14.__newindex(p13, p14, p15)
		if p15 then
			local l__parent__15 = p12.parent;
			local v16 = p12:CreateAnimation(p14, p15);
			if not v16 then
				return;
			end;
			v12[p14] = v16;
			if p12.controller:IsDescendantOf(l__workspace__3) then
				v13[p14] = p12:LoadAnimation(v16);
				return;
			end;
		else
			local v17 = v12[p14];
			if v17 then
				v17:Destroy();
			end;
			local v18 = v13[p14];
			if v18 then
				v18:Stop();
				v18:Destroy();
			end;
		end;
	end;
	function v14.__index(p16, p17)
		if v12[p17] and not v13[p17] then
			warn("animation " .. p17 .. " havent be loaded!");
		end;
		return v13[p17];
	end;
	p12.list = setmetatable({}, v14);
end;
local u4 = l__CommonOHOH__1.load.CallBackManager();
function u1.AddHandleOnStop(p18, p19, p20, ...)
	assert(p18.animation_list[p19], "no animation named " .. p19);
	local v19 = { ... };
	if p18.parent.main_inst:IsDescendantOf(l__workspace__3) then
		return u4:AddRbxConnect(p18, p18.list[p19].Stopped, function()
			p20(table.unpack(v19));
		end);
	end;
	p18.__on_stop_handles = p18.__on_stop_handles or {};
	p18.__on_stop_handles[p19] = p18.__on_stop_handles[p19] or {};
	p18.__on_stop_handles[p19][p20] = v19;
	warn("character is not in work space,no connection return");
end;
function u1.AddHandleOnMark(p21, p22, p23, p24, ...)
	assert(p21.animation_list[p22], "no animation named " .. p22);
	local v20 = { ... };
	if p21.parent.main_inst:IsDescendantOf(l__workspace__3) then
		return u4:AddRbxConnect(p21, p21.list[p22]:GetMarkerReachedSignal(p23), function()
			p24(table.unpack(v20));
		end);
	end;
	p21.__on_mark_handles = p21.__on_mark_handles or {};
	p21.__on_mark_handles[p22] = p21.__on_mark_handles[p22] or {};
	p21.__on_mark_handles[p22][p23] = p21.__on_mark_handles[p22][p23] or {};
	p21.__on_mark_handles[p22][p23][p24] = v20;
	warn("character is not in work space,no connection return");
end;
function u1.AddHandleOnLoop(p25, p26, p27, ...)
	assert(p25.animation_list[p26], "no animation named " .. p26);
	local v21 = { ... };
	if p25.parent.main_inst:IsDescendantOf(l__workspace__3) then
		return u4:AddRbxConnect(p25, p25.list[p26].DidLoop, function()
			p27(table.unpack(v21));
		end);
	end;
	p25.__on_looped_handles = p25.__on_looped_handles or {};
	p25.__on_looped_handles[p26] = p25.__on_looped_handles[p26] or {};
	p25.__on_looped_handles[p26][p27] = v21;
	warn("character is not in work space,no connection return");
end;
function u1.InWorkspace(p28)
	local l__track_list__22 = p28.track_list;
	for v23, v24 in pairs(p28.animation_list) do
		if not l__track_list__22[v23] then
			l__track_list__22[v23] = p28:LoadAnimation(v24);
		end;
	end;
	local l____on_stop_handles__25 = p28.__on_stop_handles;
	if l____on_stop_handles__25 then
		for v26, v27 in pairs(l____on_stop_handles__25) do
			local v28 = l__track_list__22[v26];
			for v29, v30 in pairs(v27) do
				u4:AddRbxConnect(p28, v28.Stopped, function()
					v29(table.unpack(v30));
				end);
			end;
		end;
	end;
	p28.__on_stop_handles = nil;
	local l____on_mark_handles__31 = p28.__on_mark_handles;
	if l____on_mark_handles__31 then
		for v32, v33 in pairs(l____on_mark_handles__31) do
			local v34 = l__track_list__22[v32];
			for v35, v36 in pairs(v33) do
				for v37, v38 in pairs(v36) do
					u4:AddRbxConnect(p28, v34:GetMarkerReachedSignal(v35), function()
						v37(table.unpack(v38));
					end);
				end;
			end;
		end;
	end;
	p28.__on_mark_handles = nil;
	local l____on_looped_handles__39 = p28.__on_looped_handles;
	if l____on_looped_handles__39 then
		for v40, v41 in pairs(l____on_looped_handles__39) do
			local v42 = l__track_list__22[v40];
			for v43, v44 in pairs(v41) do
				u4:AddRbxConnect(p28, v42.DidLoop, function()
					v43(table.unpack(v44));
				end);
			end;
		end;
	end;
	p28.__on_looped_handles = nil;
end;
return u1;
